﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using Aliphant.Mvvm.XEvent.Events;
using Aliphant.UI;
using Aliphant.UI.Widgets;

namespace TsingStandardModule.Views
{
    /// <summary>
    /// WidgetTS.xaml 的交互逻辑
    /// </summary>
    public partial class WidgetTS : BaseWidget, IWidget
    {
        private WindowEvent _windowEvent;

        public WidgetTS()
        {
            InitializeComponent();

            _windowEvent = TSModule.EventAgent.GetEvent<WindowEvent>();
        }

        public void Init(Widget widget)
        {

        }

        public string? QuickButton1Tip => string.Empty;

        public string? QuickButton2Tip => string.Empty;

        public string? QucikButton1Icon => string.Empty;

        public string? QucikButton2Icon => string.Empty;

        public void SetScriptPath(string scriptPath)
        {

        }

        public void QuickAction1()
        {

        }

        public void QuickAction2()
        {

        }

        public void Close()
        {
            _windowEvent.Publish(new WindowEvent
            {
                Type = EventType.Action,
                WindowActionType = WindowActionType.Close,
                EventId = EventIds.Release
            });
        }

        private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            var txb = sender as TextBox;
            if (txb != null)
            {
                txb.ScrollToEnd();
            }
        }
    }
}
